﻿CREATE VIEW [dbo].[ASMS_V_SettlementBillServiceItem]
	AS 
SELECT SBSI.*,
	SI.[Name] as ServiceItemName,
	WB.[Status] as ActualStatus,
	WB.TechnicianId as ActualTechnicianId,
	S1.Name as ActualtechnicianName
FROM ASMS_SettlementBillServiceItem as SBSI
	left join ASMS_ServiceItem as SI on SI.Id = SBSI.ServiceItemId
	left join ASMS_WorkingBill as WB on WB.[Status] = 1 and WB.MaintenanceBillServiceItemId = SBSI.MaintenanceBillServiceItemId
	left join ASMS_Staff as S1 on S1.Id = WB.TechnicianId
